function array_sort(array) {
    // [{}, {}, {}...] 排序: 如果id相同，按照age的升序
    array.sort(function(a, b){
        if(a.id === b.id){
            return a.age - b.age;
        }else{
            return a.id - b.id;
        }
    })
    return array;
}
var arr6 = [
    {id: 10, name: "张三", age: 2},
    {id: 5, name: "李四", age: 4},
    {id: 6, name: "王五", age: 10},
    {id: 9, name: "赵六", age: 6},
    {id: 2, name: "陈七", age: 8},
    {id: 10, name: "孙八", age: 9}
];

console.log(array_sort(arr6));
